<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<html>
<head>
	<title>院校管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/liuxue/recommend/school">院校列表</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="school" action="${ctx}/liuxue/school/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>院校名：</label>
				<form:input path="schoolName" htmlEscape="false" maxlength="50" class="input-medium"/>
			</li>
			<li><label>地点：</label>
				<sys:treeselect id="area" name="area.id" value="${school.area.id}" labelName="area.name" labelValue="${school.area.name}"
					title="区域" url="/sys/area/treeData" cssClass="input-small" allowClear="true" notAllowSelectParent="true"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>院校名</th>
				<th>地点</th>
				
				<th>更新时间</th>
				<th>备注信息</th>
				<th>专业</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="school">
			
			<c:choose>
				
			   <c:when test="${school.profIntroList== null || fn:length(school.profIntroList) == 0}">
				<tr>

					<td><a href="${ctx}/liuxue/school/form?id=${school.id}">
						${school.schoolName}
					</a></td>
					<td>
						${school.area.name}
					</td>
					<td>
						<fmt:formatDate value="${school.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
					</td>
					<td>
						${school.remarks}
					</td>

					<td></td>
					<td>
						<a href="${ctx}/liuxue/school/view?id=${school.id}">查看</a>
						<a href="${ctx}/liuxue/recommend/form?school.id=${school.id}">推荐</a>
					</td>
				</tr>
			   </c:when>
			   
			   <c:otherwise>
			   <c:set var="index" value="0" />
	   			<c:forEach items="${school.profIntroList}" var="prof">
				
				<tr>
					<c:if test="${index==0}">
					
						<td rowspan="${fn:length(school.profIntroList) }"><a href="${ctx}/liuxue/school/form?id=${school.id}">
							${school.schoolName}
						</a></td>
						<td rowspan="${fn:length(school.profIntroList) }">
							${school.area.name}
						</td>
						<td rowspan="${fn:length(school.profIntroList) }">
							<fmt:formatDate value="${school.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
						</td>
						<td rowspan="${fn:length(school.profIntroList) }">
							${school.remarks}
						</td>
					</c:if>
					<td>${prof.profName}</td>
					<td>
						<a href="${ctx}/liuxue/school/view?id=${school.id}">查看</a>
						<a href="${ctx}/liuxue/recommend/form?school.id=${school.id}&profession=${prof.id}">推荐</a>
					</td>
				</tr>
				<c:set var="index" value="${index+1}" />
			</c:forEach>
			   </c:otherwise>
			  
			</c:choose>


		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>